<template>
	<div>
		<el-card class="box-card" shadow="never">
			<div slot="header">
				<span>💐 发帖</span>
			</div>
			<!-- 若用户已登录，则显示 “发表想法” 按钮 -->
			<div v-if="token != null && token !== ''" class="has-text-centered">
				<b-button type="is-danger" tag="router-link" :to="{ path: '/post/create' }" outlined>
					✍ 发表想法
				</b-button>
			</div>
			<!-- 若用户没登录，则显示 “马上入驻” 和 “社区登入” 按钮 -->
			<div v-else class="has-text-centered">
				<b-button type="is-primary" tag="router-link" :to="{ path: '/register' }" outlined>
					马上入驻
				</b-button>
				<b-button type="is-danger" class="ml-2" tag="router-link" :to="{ path: '/login' }" outlined>
					社区登入
				</b-button>
			</div>
		</el-card>
	</div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
	name: 'LoginWelcome',

	computed: {
		...mapGetters(['token']),
	},
}
</script>

<style scoped>
</style>